/**
 *  appwindow.vala
 *
 *  Copyright (c) 2007 Marcelo Lira dos Santos <setanta@gmail.com>
 *                2007 INdT (Instituto Nokia de Technologia)
 *
 *  Author: Marcelo Lira dos Santos <setanta@gmail.com>
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License as
 *  published by the Free Software Foundation; either version 2 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 *  USA
 */

using GLib;
using Gtk;

public enum {
  COLOR_RED,
  COLOR_GREEN,
  COLOR_BLUE
};

public enum {
  SHAPE_SQUARE,
  SHAPE_RECTANGLE,
  SHAPE_OVAL
};

public class AppWindow : GLib.Object
{
    public Window window;

    private void
    activate_action (Action action)
    {
    }

    private void
    activate_radio_action (Action action, RadioAction current)

    private void
    activate_email (AboutDialog about,
                    const string link,
                    pointer data)
    {
    }

    private void
    activate_url (AboutDialog about,
                  const string link,
                  pointer data)
    {
    }

    private void
    about_cb (Action action,
              Widget window)
    {
    }

    private void
    tool_menu_action_class_init (ToolMenuActionClass *class)
    {
    }

    private void
    tool_menu_action_init (ToolMenuAction *action)
    {
    }

    private void
    register_stock_icons (void)
    {
    }

    private void
    update_statusbar (TextBuffer buffer,
                      Statusbar  statusbar)
    {
    }

    private void
    mark_set_callback (TextBuffer     buffer,
                       const TextIter new_location,
                       TextMark mark,
                       pointer  data)
    {
    }

    private void
    update_resize_grip (Widget           widget,
                        Gdk.EventWindowState event,
                        Statusbar        statusbar)
    {
    }

    public Window do_appwindow ()
    {
        window = new Window(WindowType.TOPLEVEL);
        window.title = "Application Window";
        window.icon_name = "gtk-open";
        window.border_width = 10;
        window.destroy += Gtk.main_quit;

        Table table = new Table(1, 4, false);
        window.add(table);

        /* Create the menubar and toolbar */
        ActionGroup action_group = new ActionGroup("AppWindowActions");
        Action open_action = new Action("Open", "_Open", "Open a file", STOCK_OPEN);

        action_group.add_action(open_action);
        open_action.unref();
        action_group.add_actions(entries, n_entries, window);
        action_group.add_toggle_actions(toggle_entries, n_toggle_entries, null);
        action_group.add_radio_actions(color_entries,
                                       n_color_entries
                                       COLOR_RED,
                                       activate_radio_action,
                                       null);
        action_group.add_radio_actions(shape_entries,
                                       n_shape_entries,
                                       SHAPE_SQUARE,
                                       activate_radio_action,
                                       null);

        UIManager merge = new UIManager();
        //...

        return window;
    }

    static int main (string[] args) {
        Gtk.init(out args);

        AppWindow aw = new AppWindow();

        var win = aw.do_appwindow();
        try {
            win.set_default_icon_from_file("v-icon.png");
        } catch (GLib.Error error) {
            critical(error.message);
        }
        win.show_all();

        Gtk.main();

        return 0;
    }
}
